<template>
  <el-container class="layout-container-demo">
    <el-aside width="200px">
      <el-scrollbar>
        <el-menu :default-openeds="['1', '2', '3']" background-color="transparent" text-color="#fff"
          active-text-color="#ffd04b" @select="selectmenu">
          <el-menu-item index="1">
            <el-icon><UserFilled /></el-icon>
            <span>员工管理</span>
          </el-menu-item>
          <el-menu-item index="2">
            <el-icon><CreditCard /></el-icon>
            <span>薪资管理</span>
          </el-menu-item>
          <el-menu-item index="3">
            <el-icon><OfficeBuilding /></el-icon>
            <span>部门管理</span>
          </el-menu-item>
        </el-menu>
      </el-scrollbar>
    </el-aside>

    <el-container>

      <el-header class="headerstyle" style="display:flex; justify-content: center;  font-size: 16px">
        <div style="display:flex;width: 100%; align-items: center;justify-content: center;"><span
            style="font-size: 30px;">综合信息管理系统</span></div>
        <div style="width: 300px; justify-items: right;">
          <div class="toolbar">
            <span>{{ orgname }}--{{ username }}</span>
            <el-dropdown style="margin-left: 20PX;" @command="execommand">
              <el-icon style="margin-right: 8px; margin-top: 1px;color: aliceblue;">
                <close />
              </el-icon>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item command="about">关于</el-dropdown-item>
                  <el-dropdown-item command="exit">退出系统</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>

          </div>
        </div>
      </el-header>

      <el-main>
        <!-- <el-scrollbar> -->
        <router-view> </router-view>
        <!-- </el-scrollbar> -->
      </el-main>
    </el-container>
  </el-container>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { Menu as IconMenu, Message, Setting, Close } from '@element-plus/icons-vue'
import { ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router';

const router = useRouter();

function execommand(value: string) {
  if (value == "about") {
    ElMessageBox.alert("本系统由公司内部开发，仅供内部使用，禁止外传！！！");

  }
  else {
    router.push('/login')

  }
}

function selectmenu(value: string) {

  switch (value) {
    case "1":
      router.push('/home/employee')
      break;
    case "2":
      router.push('/home/salary')
      break;
    case "3":
      router.push('/home/department')
      break;
  }

}

let orgname = "成都信息工程大学网络空间安全学院"
let username = "张三"

</script>

<style scoped>
.headerstyle {
  background: url('@/styles/images/asidebg.jpg');
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  justify-content: center;
  font-size: 18px
}

.layout-container-demo {
  font-size: 20px;
}

.layout-container-demo .el-header {

  position: relative;
  /* background-color: var(--el-color-primary-light-7); */
  background-color: #152545;
  /* color: var(--el-text-color-primary); */
  color: #fff;


}

.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  /* background: var(--el-color-primary-light-8);  */
  background: url('@/styles/images/asidebg.jpg');
  background-repeat: no-repeat;
  background-size: cover;
  height: 100VH;
}

.layout-container-demo .el-menu {
  border-right: none;
}

.layout-container-demo .el-main {
  padding: 0;
}

.layout-container-demo .toolbar {
  display: flex;
  align-items: center;
  justify-content: right;
  height: 100%;
  right: 20px;
}
</style>